import Vue from 'vue'
import Vuex from 'vuex'
import settings from "@/settings.js"

Vue.use(Vuex)

// 
export default new Vuex.Store({
	state: {
		appId: settings.appId,
		enterpriseId: '',
		userLevel: '', //  null:admin ;  1：油企；  2：油站；   3：员工；  5：区域经理 ； 6：业务员 ； 
		userInfo: uni.getStorageSync('userInfo') ? JSON.parse(uni.getStorageSync('userInfo')) : {},
		couponInfo:uni.getStorageSync('couponInfo') ? JSON.parse(uni.getStorageSync('couponInfo')) : {}
	},
	getters: {},
	mutations: {
		SET_USERlEVEL: (state, userLevel) => {
			state.userLevel = userLevel
		},
		SET_ENTERPRISEID: (state, enterpriseId) => {
			state.enterpriseId = enterpriseId
		},
		SET_USERINFO: (state, userInfo) => {
			state.userInfo = userInfo
		},
		SET_COUPONINFO:(state,couponInfo) =>{
			state.couponInfo = couponInfo
		}
	},
	actions: {

	},
	modules: {

	}
})